<!DOCTYPE html>
<html lang="zh-cn">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<include file="Widget/head" />
	<link rel="stylesheet" href="__PUBLIC__/font-awesome-4.4.0/css/font-awesome.min.css" />
	<script type="text/javascript">
	$.parser.onComplete = function () {
		//
	}
	var msgint,msgbottom=0;
	$(function(){

		$("#chgpwd").hide();
		
		$("#menutree").tree({
			onClick:function(node) {
				try {
					if (node.attributes.url != '') {
						addTab(node.text,node.attributes.url);
					}
				}catch(e){}
			}
		});
/*
		var aa = $.messager.show({
			title:'My Title1',
			msg:'The message content',
			timeout:0,
			showType:'show',
			style:{left:'',top:'',right:0,bottom: msgbottom},
			onOpen: function() {
				msgbottom +=100;
			},
			onClose: function() {
				msgbottom -=100;
				alert(msgbottom);
			}
		});
		msgint = window.setInterval("msgquery()",1000*60*5); //5分钟
		*/
		
	});
	function addTab(subtitle, url,update) {
		var $tabs = $('#tabs');
		if (!$tabs.tabs('exists', subtitle)) {
			$tabs.tabs('add', {
				title: subtitle,
				content: createFrame(url),
				closable: true,
				cache:false,
				height: $('#mainPanle').height(),
				//extractor: function(data) {}  //ajax处理
			});
		}else if (update==true) {
			var tmptab = $tabs.tabs('getTab',subtitle);
			$tabs.tabs('update', {
				tab: tmptab,
				options: {
					content: createFrame(url),
					cache:false,
				}
			});
			tmptab.panel('refresh');
			$tabs.tabs('select', subtitle);
		}else {
			$tabs.tabs('select', subtitle);
		}
	}
	function createFrame(url) {
		var s = '<iframe name="mainFrame" frameborder="0"  src="' + url + '" style="width:100%;height:99%;"></iframe>';
		return s;
	}
	
	function msgquery() {
		/*
		$.messager.show({
			title:'My Title1',
			msg:'The message content',
			timeout:0,
			showType:'show',
			style:{left:'',top:'',right:0,bottom: msgbottom},
			onOpen: function() {
				msgbottom +=100;
			},
			onClose: function() {
				msgbottom -=100;
				alert(msgbottom);
			}
		});
		*/
	}
	
	function chgpwd() {
		$("#chgpwd").show();
		$("#chgpwd").dialog({
			title: "修改密码",
			iconCls: "icon-save",
			cache: false,
			modal: true,
			buttons:[{
				iconCls: 'icon-save',
				text: "保存",
				handler:function(){
					//$("body").easyMask('show');
					$('#formPwd').form('submit',{
						url: "{:U('chgPwd')}",
						onSubmit: function(param){
							if ($(this).form('validate')) {
								$("body").easyMask('show');
							}else {
								return false;
							}
						},
						success: function(dd) {
							dd = JSON.parse(dd);
							$("body").easyMask('hide');
							if (dd.status) {
								$.messager.alert('',dd.info,'info');
								$("#chgpwd").dialog('close');
								$('#formPwd').form("clear");
							}else $.messager.alert('',dd.info,'error');
						}
					});
				}
			},{
				iconCls: 'icon-cancel',
				text: "关闭",
				handler:function(){
					$("#chgpwd").dialog('close');
					$('#formPwd').form("clear");
				}
			}]
		});
	}
	function logout() {
		$.messager.confirm('', '确认退出登录吗?', function(r) {
			if (r){
				$("body").easyMask('show');
				$.ajax({
					cache: false,
					type: "post",
					url: "{:U('Common/logout')}",
					async: true, //同步请求, 其它操作必须等待请求完成才可以执行
					success: function(dd) {
						$("body").easyMask('hide');
						//$.messager.alert('',dd.info,'info');
						location.href = dd.url;
					},
					error: function() {
						$("body").easyMask('hide');
					}
				});
			}
		});
	}
	</script>
</head>

<body class="easyui-layout">
<noscript>
	<div style="position: absolute; z-index: 100000; height: 2046px; top: 0px; left: 0px; width: 100%; background: white; text-align: center;">
		<img src="images/noscript.gif" alt='抱歉，请开启脚本支持！' />
	</div>
</noscript>

<div region="north" split="false" class="idx_north">
刷单平台管理系统
	<div class="idx_north_btns">
		欢迎,admin
		&nbsp;
		<a href="javascript:void(0)" onclick="chgpwd();" ><i class="fa fa-lock" style="color:green;display: inline;padding-right:5px;"></i>修改密码</a>
		&nbsp;
		<a href="javascript:void(0)" onclick="logout()" ><i class="fa fa-power-off" style="color:red;display: inline;padding-right:5px;"></i>退出</a>
	</div>
</div>
<div region="west" split="true" title="导航菜单" style="width: 190px;padding:5px;overflow-x:hidden;">
	<ul id="menutree" class="easyui-tree" data-options="url:'{:U(\'Index/menuTree\')}',animate:true,lines:true"></ul>
</div>
<div region="center" id="mainPanle" style="overflow:hidden;">
	<div id="tabs" class="easyui-tabs" fit="true" border="false">
		<div title="主页" style="padding: 20px;" id="home">
		<h1>Welcome...</h1>
		</div>
	</div>
</div>
<div region="south" split="false" class="idx_south">
Copyright © 2014-2015 dx623.com <a href="http://www.dx623.com/" target="_blank">东翔科技</a> All Rights Reserved Powered by Rocksnap
</div>

<div id="chgpwd" style="  padding: 10px 20px;">
<form id="formPwd" method="post">
	<table cellspacing="0" cellpadding="3">
	<tr>
		<td>原始密码:</td>
		<td><input class="easyui-textbox" type="password" name="org" data-options="required:true"></td>
	</tr>
	<tr>
		<td>新密码:</td>
		<td><input class="easyui-textbox" type="password" name="new" data-options="required:true"></td>
	</tr>
	<tr>
		<td>确认密码:</td>
		<td><input class="easyui-textbox" type="password" name="renew" data-options="required:true"></td>
	</tr>
	</table>
</form>
</div>

</body>
</html>